import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'main',
    component: () => import('../views/Main.vue'),
    redirect: '/home',
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('../views/home/Home.vue')
      },
      {
        path: '/user',
        name: 'user',
        component: () => import('../views/user/User.vue')
      }
    ]
  },
  {
    path: '/sub-vite-ts/:page*', // vue-router@4.x path的写法为：'/my-page/:page*'
    name: 'sub-vite-ts',
    component: () => import('../views/Main.vue')
  }, 
  {
    path: '/sub-vite-js/:page*', // vue-router@4.x path的写法为：'/my-page/:page*'
    name: 'sub-vite-js',
    component: () => import('../views/Main.vue')
  }, 
  {
    path: '/sub-vue-js/:page*', // vue-router@4.x path的写法为：'/my-page/:page*'
    name: 'sub-vue-js',
    component: () => import('../views/Main.vue')
  },
  // {
  //   path: '/module/:app*', // vue-router@4.x path的写法为：'/my-page/:page*'
  //   name: 'app',
  //   component: () => import('../views/Main.vue')
  // },
  // {
  //   path: '/module/:app2*', // vue-router@4.x path的写法为：'/my-page/:page*'
  //   name: 'app2',
  //   component: () => import('../views/Main.vue')
  // },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  }
]

const router = createRouter({
  history: createWebHistory('/'),
  routes
})

export default router